//
//  Function06_VC.m
//  Hwi_Library_Demo
//
//  Created by Jeonghwi Kim on 13. 7. 8..
//  Copyright (c) 2013년 KDML. All rights reserved.
//

#import "Function06_VC.h"



@implementation Function06_VC

- (IBAction)on_back_btn:(id)sender
{
    [self.navigationController popToRootViewControllerAnimated:YES];
}


- (IBAction)on_touch_down_background:(id)sender
{
    [[self get_first_responder] resignFirstResponder];
}

-(id)get_first_responder
{
 for(UIView *v in self.view.subviews)
 {
     if([v isFirstResponder])
     {
         return v;
     }
 }
    return nil;
}

- (IBAction)on_btn01_format:(id)sender
{
    NSString *input_string = self.textfield01_input.text;
    if(input_string.length==8 )
    {
        self.label01_type01_date.text = [self.hwi hwi06_get_date_with_type:0 string:input_string];
        self.label02_type02_date.text = [self.hwi hwi06_get_date_with_type:1 string:input_string];
    }
    else
    {
        [[[UIAlertView alloc] initWithTitle:@"alert" message:@"Please type 8 length number" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show];
    }
}

-(void)init_views
{
    
    NSDictionary *date_dic = [self.hwi hwi06_get_now_is_ko_KR:YES];
    
    self.label03_type03_date.text =[NSString stringWithFormat:@"%@-%@-%@ %@:%@:%@",[date_dic objectForKey:@"year"],[date_dic objectForKey:@"month"],[date_dic objectForKey:@"day"],[date_dic objectForKey:@"hour"],[date_dic objectForKey:@"minute"],[date_dic objectForKey:@"second"]];
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.hwi = [Hwi get_instance];

    [self.hwi hwi06_get_date_with_type:1 string:@"20130505"];
    [self init_views];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
